frappe.ready(() => {
    frappe.call('alert_popup.api.get_alerts').then(r => {
        if (r.message && r.message.length > 0) {
            let alerts = r.message.map(d => '<li>' + d + '</li>').join('');
            let alert_html = `
                <div class="modal fade" id="alertModal" tabindex="-1" role="dialog">
                  <div class="modal-dialog" role="document">
                    <div class="modal-content">
                      <div class="modal-header">
                        <h5 class="modal-title">系统提醒</h5>
                      </div>
                      <div class="modal-body">
                        <ul>${alerts}</ul>
                      </div>
                    </div>
                  </div>
                </div>`;
            $('body').append(alert_html);
            $('#alertModal').modal('show');
        }
    });
});